﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dictionary.aspx.cs" Inherits="SaaS.Dictionary" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Dictionary</title>
</head>
<body background="https://minisaas.blob.core.windows.net/img/bg.jpg">
    <form id="form2" runat="server">
    <div>
    
        <asp:HyperLink ID="HyperLink1" runat="server" 
            NavigateUrl="~/UserLogin.aspx">&lt;- Back</asp:HyperLink>
    
        <br />
    
        <br />
        Dictionary Input:&nbsp;
        <asp:TextBox ID="txtInput" runat="server" Width="171px" 
            style="margin-left: 0px"></asp:TextBox>
        <br />
        Definition:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:TextBox ID="txtOutput" runat="server" Width="171px" 
            style="margin-left: 18px"></asp:TextBox>
        &nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="btnAdd" runat="server" onclick="Button1_Click" Text="Add" />
        <br />
&nbsp;<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="Entry_ID" DataSourceID="SqlDataSource1" 
            ForeColor="#333333" GridLines="None" 
            style="margin-top: 0px">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:BoundField DataField="Entry_ID" HeaderText="Entry_ID" ReadOnly="True" 
                    SortExpression="Entry_ID" />
                <asp:BoundField DataField="Input" HeaderText="Input" 
                    SortExpression="Input" />
                <asp:BoundField DataField="Output" 
                    HeaderText="Output" SortExpression="Output" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MiniSaaSConnectionString %>" 
            
            SelectCommand="SELECT [Entry_ID], [Input], [Output] FROM [DICTIONARY]" 
            DeleteCommand="DELETE FROM [DICTIONARY] WHERE [Entry_ID] = @Entry_ID" 
            InsertCommand="INSERT INTO [DICTIONARY] ([Entry_ID], [Input], [Output]) VALUES (@Entry_ID, @Input, @Output)" 
            
            UpdateCommand="UPDATE [DICTIONARY] SET [Input] = @Input, [Output] = @Output WHERE [Entry_ID] = @Entry_ID">
            <DeleteParameters>
                <asp:Parameter Name="Entry_ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Input" Type="String" />
                <asp:Parameter Name="Output" Type="String" />
                <asp:Parameter Name="Entry_ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Entry_ID" Type="Int32" />
                <asp:Parameter Name="Input" Type="String" />
                <asp:Parameter Name="Output" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
